package kubayaxi.video.client.config;


import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

/**
 * swagger文档配置
 */
@Configuration
@EnableSwagger2
public class SwaggerClientConfig {

    @Value("${kubayaxi.swagger.enable:false}")
    private Boolean swaggerEnable;

    /**
     * swagger配置
     */
    @Bean
    public Docket docket() {
        return new Docket(DocumentationType.SWAGGER_2).enable(swaggerEnable)
                .select()
                .apis(RequestHandlerSelectors.basePackage("kubayaxi.video.client.controller"))
                .paths(PathSelectors.regex("(?!/error.*).*"))
                .build()
                .apiInfo(new ApiInfoBuilder()
                        .title("kubayaxiVideo-客户")
                        .description("客户端接口")
                        .version("1.0.0").build());
    }

}
